import server from "@/utils/request";
//获取全部菜单信息
export function getList(data) {
    return server({
        url: '/category',
        method: 'get',
        data: data
    })
}

// 添加分类信息
export function addCategory(data) {
    return server({
        url: '/category',
        method: 'post',
        data: data
    })
}

// 获取单个分类信息
export function getCategory(id) {
    return server({
        url: `/category/${id}`,
        method: 'get',
    });
}

// 更新分类信息
export function updateCategory(data) {
    return server({
        url: `/category`,
        method: 'put',
        data: data
    })
}

// 删除分类信息
export function deleteCategory(id) {
    return server({
        url: `/category/${id}`,
        method: 'delete',
    })
}

// 模糊查询分类信息
export function searchByName(name) {
    return server({
        url: `/category/searchByName`,
        method: 'get',
        params: { name } // 使用 params 传递查询参数
    });
}